package com.example.demo.controller;

import com.example.demo.pojo.Goodsaddguanli;
import com.example.demo.pojo.Swiperdata;
import com.example.demo.pojo.UserInfo;
import com.example.demo.service.UserInfoService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yanglup
 * @create 2020-12-12 16:28
 *
 * 小程序端
 */
@RestController
public class UserInfoController {
    @Autowired
    UserInfoService userInfoService;
    /**插入用户信息*/
    @RequestMapping("/user/userInfoadd")
    public String userInfoadd(String openid,String nickName,Integer gender,String city,
                              String province,String country,String avatarUrl){
        //先查询是否有用户
        Integer mycheck=userInfoService.userInfocheck(openid);
        if (mycheck.equals(1)){
            userInfoService.userInfoadd(openid,nickName,gender,city,province,country,avatarUrl);
        }
        return "ok";
    }


//    /**判断用户是否存在*/
//    @RequestMapping("/user/userInfoadd")
//    public String userInfoadd(String openid,String nickName,Integer gender,String city,
//                              String province,String country){
//        //先查询是否有用户
//        Integer mycheck=userInfoService.userInfocheck(openid);
//        if (mycheck.equals(1)){
//            userInfoService.userInfoadd(openid,nickName,gender,city,province,country);
//        }
//        return "ok";
//    }

}
